package com.example.demo.test;

/**
 * @ClassName mertics_const
 * @Description
 * @date 2022/12/19 14:06
 * @Author yanceysong
 * @Version 1.0
 */
public class metrics_const {
    public static final String GET_MEM_COMMAND = "free |grep '^Mem:'|awk '{print int($2),int($7)}'";
    /**
     * us：用户空间占用CPU百分比（Host.cpu.user）
     * sy：内核空间占用CPU百分比（Host.cpu.system）
     * ni：用户进程空间内改变过优先级的进程占用CPU百分比
     * id：空闲CPU百分比（Host.cpu.idle）
     * wa：等待输入输出的CPU时间百分比
     * hi：硬件中断
     * si：软件中断
     * st：实时
     */
    public static final String GET_CPU_USED_COMMAND = "top -b -n 1|grep '%Cpu(s):' |awk '{print ($2),($4)}'";
    public static final String GET_CPU_CORE_NUMBERS_COMMAND = "lscpu|grep 'NUMA node0 CPU(s)'|awk '{print $NF}'|awk -F'-' '{print $2+1}'";
    public static final String GET_DISK_COMMAND = "df / |grep dev| awk '{print ($2),($3)}'";
    public static final String MONITOR_ITEM_CPU = "cpu";
    public static final String MONITOR_ITEM_MEM = "mem";
    public static final String MONITOR_ITEM_DISK = "disk";
}
